<%--
  Created by IntelliJ IDEA.
  User: liaoh
  Date: 2017/6/13
  Time: 22:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生管理系统</title>

  <script>
    function isValid(form) {
      if (form.id.value == "") {
        alert("学号不能为空！")
        return false
//        window.location.href="addstudent.jsp";
      }
      if (form.name.value == "") {
        alert("姓名不能为空！")
//        window.location.href="addstudent.jsp";
        return false
      }
      if (form.password.value == "") {
        alert("密码不能为空！")
//        window.location.href="addstudent.jsp";
        return false
      }
      else return true;
    }
  </script>

</head>
<body>
<form action="/add" method="post" onsubmit="isValid(this)">
  学号：<input type="text" name="id"/>
  姓名：<input type="text" name="name"/>
  密码：<input type="password" name="password"/>
  <input type="submit" value="注册"/>
</form>
</body>
</html>
